Skip to content

docs(docsite): fix ColorVariants story 'Show code' to follow index re-export pattern#1136

Closed
Hotell wants to merge 1 commit into
microsoft:mainfrom
Hotell:copilot/fix-storybook-code-display
Closed

docs(docsite): fix ColorVariants story 'Show code' to follow index re-export pattern#1136
Hotell wants to merge 1 commit into
microsoft:mainfrom
Hotell:copilot/fix-storybook-code-display

Conversation

@Hotell

@Hotell Hotell commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Problem

The Show code panel on the Icons / Color Variants story was displaying the entire story module — the default meta, argTypes, and the custom docs.page render — instead of just the example component.

Root cause

The Fluent @fluentui/react-storybook-addon-export-to-sandbox addon shows the whole story module source (so it can be exported to a sandbox). The rest of the docsite avoids this by following an index re-export pattern: each story lives in its own dedicated *.stories.tsx file containing only that example, while index.stories.tsx re-exports the stories and holds the meta/argTypes/page boilerplate.

ColorVariants/index.stories.tsx broke this by defining the ColorIdPrefix story inline alongside all the meta config, so everything leaked into the code display.

Fix

  • Add ColorVariants/ColorVariants.stories.tsx containing only the ColorIdPrefix story (imports, styles, component). This is now the clean source shown in Show code.
  • Rewrite ColorVariants/index.stories.tsx to re-export the story and hold the default meta/argTypes/page config, mirroring Icons/index.stories.tsx and FileTypeIcons/index.stories.tsx.

The sibling ColorVariants.stories.tsx is not double-registered because the Storybook glob only matches **/index.stories.@(ts|tsx).

Verification

  • npx nx run docsite:build completes successfully (Storybook + SWC compile all stories with no errors).

The 'Show code' panel was displaying the entire story module (meta,
argTypes and custom docs page) because ColorVariants/index.stories.tsx
defined the story inline instead of following the repo's index
re-export pattern.

Move the ColorIdPrefix story into a dedicated ColorVariants.stories.tsx
and re-export it from index.stories.tsx, matching the pattern used by
Icons/index.stories.tsx and FileTypeIcons/index.stories.tsx.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

📋 PR Validation Summary

Check the Build react library job summary for detailed reports:

  • 📦 Bundle Size — size comparison against the base branch
  • 📖 Docsite Preview — build artifact with local preview instructions

To view: click the link above → select the Build react library job → open the Summary tab.

@Hotell Hotell marked this pull request as ready for review July 2, 2026 15:47
@Hotell Hotell requested a review from a team as a code owner July 2, 2026 15:47
@Hotell

Hotell commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator Author

replaced by #1138

@Hotell Hotell closed this Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant